/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tutorial.ideePtProiect.ModelStuff;

import java.util.LinkedList;
import java.util.List;

/**
 *
 * @author Boogie
 */
public class Model {
    
    private String stuff;

    private List<OnPropertyChangedListener> listeners;
    
    
    public Model() {
        listeners = new LinkedList<>();
    }
    public Model(OnPropertyChangedListener...listeners){
        this();
        for(OnPropertyChangedListener l : listeners){
            this.addOnPropertyChangedListener(l);
        }
    }
    

    public final void removeOnPropertyChangedListener(OnPropertyChangedListener e) {
         listeners.remove(e);
    }

    public final void addOnPropertyChangedListener(OnPropertyChangedListener e) {
         listeners.add(e);
    }
    
    

    public String getStuff() {
        return stuff;
    }

    public void setStuff(String stuff) {
        this.stuff = stuff;
        for(OnPropertyChangedListener l: listeners){
            l.onPropertyChanged(new Property("Stuff",this));
        }
    }
    
    
    
}
